package io.xccit.hotelsystem.ui.mine;

import androidx.lifecycle.LiveData;
import androidx.lifecycle.MutableLiveData;
import androidx.lifecycle.ViewModel;

/**
 * 我的ViewModel
 */
public class MineViewModel extends ViewModel {

    private final MutableLiveData<String> mText;
    private final MutableLiveData<String> username = new MutableLiveData<>();
    private final MutableLiveData<Boolean> isLoggedIn = new MutableLiveData<>(false);
    
    public MineViewModel() {
        mText = new MutableLiveData<>();
        mText.setValue("This is mine fragment");
        
        username.setValue("用户名");
    }

    public LiveData<String> getText() {
        return mText;
    }
    
    public MutableLiveData<String> getUsername() {
        return username;
    }
    
    public MutableLiveData<Boolean> getIsLoggedIn() {
        return isLoggedIn;
    }
    
    public void logout() {
        // 清除用户数据
        username.setValue("");
        isLoggedIn.setValue(false);
        
        // 这里可以添加其他清理逻辑，如清除SharedPreferences中的登录信息等
    }
}